package cn.edu.jxau.controller;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.edu.jxau.domain.user;
import cn.edu.jxau.service.insertInfo;

public class insertInfoServlet extends HttpServlet {

	/**
	 * 向数据库中插入用户信息
	 */
	private static final long serialVersionUID = 1L;



	public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

		request.setCharacterEncoding("utf-8");
		response.setContentType("text/html;charset=utf-8");
		// 从表单中获取用户注册信息
		String username = request.getParameter("username");
		String mail = request.getParameter("mail");
		String phone = request.getParameter("phone");
		String password = request.getParameter("password");
		// 将表单中的数据交给service处理
		insertInfo.insert(username, mail, phone, password);
		response.sendRedirect("registerSuccess.html");
	}

}
